package com.tanhua.dubbo.server.api;


import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.User;
import com.tanhua.domain.db.UserInfo;
import com.tanhua.dubbo.server.mapper.UserInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;


import java.util.List;

@Service
public class UserInfoServiceImpl implements UserInfoApi {

    @Autowired
    private UserInfoMapper userInfoMapper;

    public void save(UserInfo userInfo) {
        this.userInfoMapper.insert(userInfo);
    }


    public void update(UserInfo userInfo) {
        this.userInfoMapper.updateById(userInfo);
    }

    public UserInfo findByUserId(Long userId) {
        return userInfoMapper.selectById(userId);
    }


    public List findByUserIds(List<Long> userIds) {
        QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.in("id", userIds);
        return this.userInfoMapper.selectList(queryWrapper);
    }
}
